package com.wanmait.shoppingsys.controller.manage;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.wanmait.shoppingsys.dao.EvaluationDAO;
import com.wanmait.shoppingsys.vo.Evaluation;

@WebServlet("/EvaluationManageControler")
public class EvaluationManageController extends HttpServlet{
private EvaluationDAO evaluationDAO=EvaluationDAO.getDAO();
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	    request.setCharacterEncoding("UTF-8");
		String action = request.getParameter("action");
		if(action==null) {
			return;
		}
		switch(action) 
		{
		case "delete":
			this.delete(request, response);
		break;
		}
 }
protected void delete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	String idStr=request.getParameter("id");
	 Integer id=Integer.parseInt(idStr);
	 evaluationDAO.delete(id);
	 response.sendRedirect("/ShoppingsSys/EvaluationController?action=evaluation");
 }
 protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}
}